<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<md-dialog>
  <form name="formApiDefinition" ng-submit="export()" novalidate>
    <md-dialog-content layout-padding>
      <div>
        <h4>Export API definition as :</h4>
        <div layout="column" layout-align="space-between center">
          <md-select ng-model="data.exportVersion" placeholder="Export as">
            <md-option value="default" selected>Current version ({{ graviteeVersion }})</md-option>
            <md-option value="3.7">3.7.x to 3.9.x version</md-option>
            <md-option value="3.0">3.0.x to 3.6.x version</md-option>
            <md-option value="1.25">1.25.x to 1.30.x version</md-option>
            <md-option value="1.20">1.20.x to 1.24.x version</md-option>
            <md-option value="1.15">1.15.x to 1.16.x version</md-option>
          </md-select>
        </div>
        <span ng-if="data.exportVersion !== 'default'" style="font-size: 75%; color: orange">
          <ng-md-icon icon="warning" style="fill: orange"></ng-md-icon>Some data loss may occur depending on the target version.
        </span>
      </div>
      <h4>What do you want to export ?</h4>
      <div layout="column">
        <md-checkbox ng-repeat="fl in filteredFields" aria-label="fl.id" ng-model="fl.checked"> {{ fl.description }} </md-checkbox>
      </div>
    </md-dialog-content>
    <md-dialog-actions layout="row">
      <md-button md-no-ink ng-click="hide()"> Cancel </md-button>
      <md-button type="submit" class="md-raised md-primary" ng-disabled="formApiDefinition.$invalid"> Export </md-button>
    </md-dialog-actions>
  </form>
</md-dialog>
